#include "Inputs.h"
#include <imgui.h>
#include <SDL.h>
#include <Core/Application.h>

namespace Engine2D
{
    bool Inputs::IsKeyDown(int key)
    {
        return ImGui::IsKeyDown(key);
    }

    bool Inputs::IsKeyPressed(int key)
    {
        return ImGui::IsKeyPressed(key);
    }

    bool Inputs::IsKeyReleased(int key)
    {
        return ImGui::IsKeyReleased(key);
    }

    float Inputs::MouseXPos()
    {
        
        return ImGui::GetIO().MousePos.x;
    }

    float Inputs::MouseYPos()
    {
        return ImGui::GetIO().MousePos.y;
    }

    float Inputs::MouseWheel()
    {
        return ImGui::GetIO().MouseWheel;
    }

    float Inputs::MouseWheelH()
    {
        return ImGui::GetIO().MouseWheelH;
    }

    bool Inputs::IsMouseDown(int key)
    {
        return ImGui::IsMouseDown(key);
    }

    bool Inputs::IsMouseClicked(int key)
    {
        return ImGui::IsMouseClicked(key);
    }

    bool Inputs::IsMouseReleased(int key)
    {
        return ImGui::IsMouseReleased(key);
    }

    float Inputs::GetWindowWidth()
    {
        int w = 0;
        int h = 0;
        SDL_GetWindowSize((SDL_Window*)Application::Instance<Application>().lock()->GetWindow().lock()->GetWindow(), 
            &w, &h
        );
        return (float)w;
    }

    float Inputs::GetWindowHeight()
    {
        int w = 0;
        int h = 0;
        SDL_GetWindowSize((SDL_Window*)Application::Instance<Application>().lock()->GetWindow().lock()->GetWindow(), 
            &w, &h
        );
        return (float)h;
    }

} // namespace Engine2D

